The next section reports the analysis and results (with corresponding
code) for Experiment 1.
Test Phase
Overall Accuracy
Below, we report average test accuracy by condition.
exp1_test_subj <- exp1_d %>%
filter(trial_type=="test") %>%
group_by(subject,condition) %>%
summarize(
mean_accuracy = mean(is_right,na.rm=TRUE)
)
exp1_test_summarized <- exp1_test_subj %>%
group_by(condition) %>%
summarize(
N=n(),
avg_accuracy = mean(mean_accuracy),
avg_accuracy_ci = qt(0.975, N-1)*sd(mean_accuracy,na.rm=TRUE)/sqrt(N),
avg_accuracy_lower_ci = avg_accuracy - avg_accuracy_ci,
avg_accuracy_upper_ci = avg_accuracy + avg_accuracy_ci,
)
exp1_test_summarized %>%
select(-avg_accuracy_ci) %>%
mutate(
ci = str_c("[",round(avg_accuracy_lower_ci,3),", ", round(avg_accuracy_upper_ci,3),"]")) %>%
select(condition,N,avg_accuracy,ci) %>%
kable(col.names=c("Condition", "N", "Average Accuracy","CI"),digits=3)
| active |
36 |
0.689 |
[0.628, 0.751] |
| passive |
36 |
0.677 |
[0.617, 0.738] |
Main Model
##maximal model does not converge, fitting simplified random effects structure below
#m <- glmer(is_right~condition_c*stim_set_c+(1+stim_set_c|subject)+(1+stim_set_c*condition_c|target_image)+(1+stim_set_c*condition_c|yoked_id), subset(exp1_d, trial_type=="test"),family="binomial")
#final model
m <- glmer(is_right~condition_c*stim_set_c+(1|subject)+(1|target_image)+(1|yoked_id), subset(exp1_d, trial_type=="test"),family="binomial")
summary(m)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## is_right ~ condition_c * stim_set_c + (1 | subject) + (1 | target_image) +
## (1 | yoked_id)
## Data: subset(exp1_d, trial_type == "test")
##
## AIC BIC logLik deviance df.resid
## 1408.5 1443.9 -697.3 1394.5 1145
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3713 -1.0997 0.4991 0.6799 1.2344
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.240054 0.48995
## yoked_id (Intercept) 0.288185 0.53683
## target_image (Intercept) 0.001261 0.03552
## Number of obs: 1152, groups: subject, 72; yoked_id, 36; target_image, 8
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.86240 0.12810 6.732 1.67e-11 ***
## condition_c 0.05710 0.17705 0.323 0.747
## stim_set_c -0.06269 0.13254 -0.473 0.636
## condition_c:stim_set_c -0.05448 0.26465 -0.206 0.837
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtn_ stm_s_
## condition_c 0.003
## stim_set_c -0.008 -0.004
## cndtn_c:s__ -0.003 -0.008 0.012
confint(m, method="Wald")
## 2.5 % 97.5 %
## .sig01 NA NA
## .sig02 NA NA
## .sig03 NA NA
## (Intercept) 0.6113345 1.1134578
## condition_c -0.2899145 0.4041220
## stim_set_c -0.3224533 0.1970771
## condition_c:stim_set_c -0.5731928 0.4642337
#extract coefficients from model
#get parameter estimates
model_estimates_exp1_main <- m %>%
tidy(effects="fixed")
To test for differences in word learning across condition, we fit a
logistic mixed-effects model predicting participants’ trial-by-trial
accuracy from condition (dummy coded), experiment block (centered), and
their interaction. The maximally converging random-effects structure
included random intercepts for participants, items, and yoked pairings
(i.e., observations from participants who were yoked together were
treated as non-independent). There was no significant difference between
word learning accuracy in the Active (M = 68.9%, 95% CI [62.8%, 75.1%])
and the Yoked Passive condition (M = 67.7%, 95% CI [61.7%, 73.8%]), b =
0.06, z = 0.32, p = 0.75. We also found no significant condition by
block interaction, b = -0.05, z = -0.21, p = 0.84.
Plot
ggplot(exp1_test_summarized,aes(condition,avg_accuracy,color=condition,fill=condition))+
geom_half_violin(data= exp1_test_subj,aes(y=mean_accuracy),position = position_nudge(x = -.1, y = 0), width=0.8,adjust=1.5,trim = T, alpha = .8,color=NA,side="l")+
geom_point(stat="identity",size=4,position = position_nudge(x = .2, y = 0))+
geom_errorbar(aes(ymin=avg_accuracy_lower_ci,ymax=avg_accuracy_upper_ci),width=0,position = position_nudge(x = .2, y = 0))+
geom_jitter(data= exp1_test_subj,aes(y=mean_accuracy),size=2,width=0.05,height=0.025,alpha=0.4,stroke=NA)+
theme_cowplot()+
theme(legend.position="none")+
geom_hline(yintercept=0.5,linetype="dashed")+
theme(axis.title = element_text(size=20),
axis.text = element_text(size=16))+
scale_color_brewer(palette="Set1")+
scale_fill_brewer(palette="Set1")+
ylim(-0.04,1.04)+
scale_x_discrete(
breaks=c("active","passive"),
labels=c("Active","Yoked Passive"))+
ylab("Word Learning Accuracy")+
xlab("Condition")

ggsave(here(figure_path,"exp1_accuracy_overall.png"),width=9,height=6,bg = "white")
Test Accuracy By Block
Here, we report average test accuracy by condition, additionally
broken down by Block.
exp1_test_subj_block <- exp1_d %>%
filter(trial_type=="test") %>%
group_by(subject,condition,stim_set) %>%
summarize(
mean_accuracy = mean(is_right,na.rm=TRUE)
) %>%
mutate(block = ifelse(stim_set==1,"BLOCK 1","BLOCK 2"))
exp1_test_summarized_block <- exp1_test_subj_block %>%
group_by(condition,stim_set, block) %>%
summarize(
N=n(),
avg_accuracy = mean(mean_accuracy),
avg_accuracy_ci = qt(0.975, N-1)*sd(mean_accuracy,na.rm=TRUE)/sqrt(N),
avg_accuracy_lower_ci = avg_accuracy - avg_accuracy_ci,
avg_accuracy_upper_ci = avg_accuracy + avg_accuracy_ci,
)
exp1_test_summarized_block %>%
ungroup() %>%
arrange(block) %>%
select(-avg_accuracy_ci,-stim_set) %>%
mutate(
ci = str_c("[",round(avg_accuracy_lower_ci,3),", ", round(avg_accuracy_upper_ci,3),"]")) %>%
select(block,condition,N,avg_accuracy,ci) %>%
kable(col.names=c("Block","Condition", "N", "Average Accuracy","CI"),digits=3)
| BLOCK 1 |
active |
36 |
0.698 |
[0.624, 0.772] |
| BLOCK 1 |
passive |
36 |
0.681 |
[0.593, 0.768] |
| BLOCK 2 |
active |
36 |
0.681 |
[0.609, 0.752] |
| BLOCK 2 |
passive |
36 |
0.674 |
[0.601, 0.747] |
ggplot(exp1_test_summarized_block,aes(condition,avg_accuracy,color=condition,fill=condition))+
geom_half_violin(data= exp1_test_subj_block,aes(y=mean_accuracy),position = position_nudge(x = -.1, y = 0), width=0.8,adjust=1.5,trim = T, alpha = .8,color=NA,side="l")+
geom_point(stat="identity",size=4,position = position_nudge(x = .2, y = 0))+
geom_errorbar(aes(ymin=avg_accuracy_lower_ci,ymax=avg_accuracy_upper_ci),width=0,position = position_nudge(x = .2, y = 0))+
geom_jitter(data= exp1_test_subj_block,aes(y=mean_accuracy),size=2,width=0.05,height=0.025,alpha=0.4,stroke=NA)+
theme_cowplot()+
theme(legend.position="none")+
geom_hline(yintercept=0.5,linetype="dashed")+
theme(axis.title = element_text(size=20),
axis.text = element_text(size=16))+
scale_color_brewer(palette="Set1")+
scale_fill_brewer(palette="Set1")+
ylim(-0.04,1.04)+
scale_x_discrete(
breaks=c("active","passive"),
labels=c("Active","Yoked Passive"))+
ylab("Word Learning Accuracy")+
xlab("Condition")+
facet_grid(~block)

ggsave(here(figure_path,"exp1_accuracy_by_block.png"),width=9,height=6,bg = "white")
Interaction with Age
#center age
exp1_d <- exp1_d %>%
mutate(age_c = age - mean(age,na.rm=T))
## maximal model does not converge - fitting model with simpler random effects structure below
#m <- glmer(is_right~condition*stim_set_c+(1+stim_set_c*condition_c|subject)+(1+stim_set_c*condition_c|target_image)+(1+stim_set_c*condition_c|yoked_id), subset(exp1_d, trial_type=="test"),family="binomial")
m <- glmer(is_right~condition_c*age_c+(1|subject)+(1|target_image)+(1|yoked_id), subset(exp1_d, trial_type=="test"),family="binomial")
summary(m)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: is_right ~ condition_c * age_c + (1 | subject) + (1 | target_image) +
## (1 | yoked_id)
## Data: subset(exp1_d, trial_type == "test")
##
## AIC BIC logLik deviance df.resid
## 1406.8 1442.1 -696.4 1392.8 1145
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5304 -1.0873 0.4941 0.6827 1.2214
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 0.2509544 0.50095
## yoked_id (Intercept) 0.2457447 0.49573
## target_image (Intercept) 0.0007412 0.02723
## Number of obs: 1152, groups: subject, 72; yoked_id, 36; target_image, 8
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.86281 0.12378 6.970 3.16e-12 ***
## condition_c 0.05466 0.17899 0.305 0.760
## age_c 0.20766 0.14702 1.412 0.158
## condition_c:age_c -0.06748 0.22613 -0.298 0.765
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtn_ age_c
## condition_c 0.002
## age_c 0.030 -0.001
## cndtn_c:g_c -0.007 0.043 0.024
confint(m, method="Wald")[4:7,]
## 2.5 % 97.5 %
## (Intercept) 0.62019533 1.1054179
## condition_c -0.29614595 0.4054701
## age_c -0.08049984 0.4958150
## condition_c:age_c -0.51068593 0.3757174
model_estimates_exp1_age_interaction <- m %>%
tidy(effects="fixed")
To test for possible differences in the effect of active learning
across age, we fit a logistic mixed-effects model predicting
participants’ trial-by-trial accuracy from condition (dummy coded), age
(centered), and their interaction. We included random intercepts for
participants, items and for yoked pairings (i.e., observations from
participants who were yoked together were treated as non-independent).
We found no evidence for an interaction between age and condition (p =
0.77).
Here, we plot the condition effect for each age group.
exp1_test_subj_age_group <- exp1_d %>%
filter(trial_type=="test") %>%
group_by(subject,condition,age_group) %>%
summarize(
mean_accuracy = mean(is_right,na.rm=TRUE)
) %>%
mutate(
age_group_f = factor(age_group, levels=c("three-year-olds","four-year-olds","five-year-olds")))
exp1_test_summarized_age_group <- exp1_test_subj_age_group %>%
group_by(condition,age_group_f) %>%
summarize(
N=n(),
avg_accuracy = mean(mean_accuracy),
avg_accuracy_ci = qt(0.975, N-1)*sd(mean_accuracy,na.rm=TRUE)/sqrt(N),
avg_accuracy_lower_ci = avg_accuracy - avg_accuracy_ci,
avg_accuracy_upper_ci = avg_accuracy + avg_accuracy_ci,
)
exp1_test_summarized_age_group %>%
ungroup() %>%
select(-avg_accuracy_ci) %>%
mutate(
ci = str_c("[",round(avg_accuracy_lower_ci,3),", ", round(avg_accuracy_upper_ci,3),"]")) %>%
select(age_group_f,condition,N,avg_accuracy,ci) %>%
kable(col.names=c("Age Group","Condition", "N", "Average Accuracy","CI"),digits=3)
| three-year-olds |
active |
9 |
0.597 |
[0.47, 0.725] |
| four-year-olds |
active |
14 |
0.732 |
[0.64, 0.824] |
| five-year-olds |
active |
13 |
0.707 |
[0.583, 0.83] |
| three-year-olds |
passive |
8 |
0.648 |
[0.548, 0.749] |
| four-year-olds |
passive |
15 |
0.621 |
[0.516, 0.726] |
| five-year-olds |
passive |
13 |
0.760 |
[0.653, 0.866] |
ggplot(exp1_test_summarized_age_group,aes(condition,avg_accuracy,color=condition,fill=condition))+
geom_half_violin(data= exp1_test_subj_age_group,aes(y=mean_accuracy),position = position_nudge(x = -.1, y = 0), width=0.8,adjust=1.5,trim = T, alpha = .8,color=NA,side="l")+
geom_point(stat="identity",size=4,position = position_nudge(x = .2, y = 0))+
geom_errorbar(aes(ymin=avg_accuracy_lower_ci,ymax=avg_accuracy_upper_ci),width=0,position = position_nudge(x = .2, y = 0))+
geom_jitter(data= exp1_test_subj_age_group,aes(y=mean_accuracy),size=2,width=0.05,height=0.025,alpha=0.4,stroke=NA)+
theme_cowplot()+
theme(legend.position="none")+
geom_hline(yintercept=0.5,linetype="dashed")+
theme(axis.title = element_text(size=20),
axis.text = element_text(size=16))+
scale_color_brewer(palette="Set1")+
scale_fill_brewer(palette="Set1")+
ylim(-0.04,1.04)+
scale_x_discrete(
breaks=c("active","passive"),
labels=c("Active","Yoked Passive"))+
ylab("Word Learning Accuracy")+
xlab("Condition")+
facet_grid(~age_group_f)

ggsave(here(figure_path,"exp1_accuracy_by_age_group.png"),width=9,height=6,bg = "white")
Additional robustness check: 3-way interaction between block, age,
and condition
#three-way interaction
m <- glmer(is_right~condition_c*stim_set_c*age_c+(1+stim_set_c|subject)+(1|target_image)+(1|yoked_id), subset(exp1_d, trial_type=="test"),family="binomial")
summary(m)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: is_right ~ condition_c * stim_set_c * age_c + (1 + stim_set_c |
## subject) + (1 | target_image) + (1 | yoked_id)
## Data: subset(exp1_d, trial_type == "test")
##
## AIC BIC logLik deviance df.resid
## 1411.2 1476.9 -692.6 1385.2 1139
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.3341 -1.0247 0.4835 0.6868 1.4080
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## subject (Intercept) 3.010e-01 0.5486600
## stim_set_c 6.352e-01 0.7969813 -0.45
## yoked_id (Intercept) 2.293e-01 0.4788059
## target_image (Intercept) 7.536e-08 0.0002745
## Number of obs: 1152, groups: subject, 72; yoked_id, 36; target_image, 8
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.89587 0.12580 7.121 1.07e-12 ***
## condition_c 0.05305 0.18839 0.282 0.778
## stim_set_c -0.12998 0.17236 -0.754 0.451
## age_c 0.21140 0.14992 1.410 0.159
## condition_c:stim_set_c -0.04951 0.33118 -0.150 0.881
## condition_c:age_c -0.07702 0.23757 -0.324 0.746
## stim_set_c:age_c 0.03355 0.20605 0.163 0.871
## condition_c:stim_set_c:age_c -0.04041 0.41055 -0.098 0.922
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtn_ stm_s_ age_c cn_:__ cnd_:_ st__:_
## condition_c -0.001
## stim_set_c -0.164 0.002
## age_c 0.031 -0.003 -0.005
## cndtn_c:s__ 0.001 -0.207 -0.001 0.001
## cndtn_c:g_c -0.009 0.039 0.002 0.024 -0.002
## stm_st_c:g_ -0.005 0.000 0.069 -0.160 -0.006 -0.010
## cndtn_:__:_ -0.001 -0.003 -0.011 -0.011 0.047 -0.203 0.025
confint(m, method="Wald")[6:13,]
## 2.5 % 97.5 %
## (Intercept) 0.64930012 1.1424452
## condition_c -0.31619474 0.4222939
## stim_set_c -0.46779372 0.2078299
## age_c -0.08243029 0.5052299
## condition_c:stim_set_c -0.69861398 0.5995892
## condition_c:age_c -0.54265744 0.3886124
## stim_set_c:age_c -0.37029989 0.4374082
## condition_c:stim_set_c:age_c -0.84505863 0.7642486
model_estimates_exp1_three_way <- m %>%
tidy(effects="fixed")
To explore whether the effect of condition depended on age, we fit a
logistic mixed-effects model predicting the likelihood of making a
correct choice from the three-way interaction between condition
(centered; Active = 0.5; Passive = -0.5), block (unit centered), age
(mean-centered), and all lower-order effects. The model included random
intercepts for participant, target image, and yoked participant id, as
well as a by-participant random slope for block. There was no evidence
of a three-way interaction between condition, age, and block, p =
0.92.